<?php
/*	define("MAPS_HOST", "maps.google.ie");
    define("KEY", "ABQIAAAAwtjRafUFzihxIswgmXPsQhRPO2D7qvb20hG5e6-AKX3BhpEHRhRun2_iwdq19JRbtr7IoNkztcPrKA");
    $address = get_input("q");                       
    $base_url = "http://" . MAPS_HOST . "/maps/geo?output=csv&key=" . KEY;
    $request_url = $base_url . "&q=" . urlencode($address);
    echo $request_url;
    $csv = file_get_contents($request_url) or die("url not loading");  
    $csvSplit = split(",", $csv);
    $lat = $csvSplit[2];
    $lng = $csvSplit[3]; 
    if ( !empty($lat) || !empty($lng)){
       $producersNeighbor = get_produceres_close ($lat,$lng, FALSE);
       $_SESSION['producers'] = $producersNeighbor;
       $_SESSION['map_latitude'] = $lat;
       $_SESSION['map_longitute']= $lng;    
       forward($CONFIG->wwwroot . 'pg/locations/all');
    } else {      
       register_error(elgg_echo('hypeLiveSearch:address_not_found'));
       forward($_SERVER['HTTP_REFERER']);       

    } */

  $latitude = get_input('latitude');
  $longitude = get_input('longitude');
  $producersNeighbor = get_produceres_close ($latitude,$longitude, FALSE);
  $_SESSION['producers'] = $producersNeighbor;	
  $_SESSION['map_latitude'] = $latitude;
  $_SESSION['map_longitute']= $longitude;    
  forward($CONFIG->wwwroot . 'pg/locations/all');

            
  
  
?>